package com.groupbuying.customer.dao;

import com.groupbuying.customer.domain.CustomerUshopDO;
import com.groupbuying.customer.dto.CustomerCurrencyDTO;
import com.groupbuying.customer.dto.CustomerCurrencyLogDTO;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 够样优店用户表
 *
 * @author zmlmagic
 * @email zmlmagic@163.com
 * @date 2019-05-14 03:22:33
 * @des
 */

@Mapper
@Repository
public interface CustomerUshopDao {

    CustomerUshopDO get(String customerId);

    List<CustomerUshopDO> list(Map<String, Object> map);

    int count(Map<String, Object> map);

    int save(CustomerUshopDO customerUshop);

    int update(CustomerUshopDO customerUshop);

    int remove(String customer_id);

    int batchRemove(String[] customerIds);

    /**
     * 根据用户来源类型查询手机号
     *
     * @param type
     * @return
     */
    Set<String> getMobileByType(String type);

    /**
     * 查询期初约
     * 查询期末余额
     *
     * @param map
     * @return
     */
    BigDecimal getStartTimasCurrency(Map<String, Object> map);

    BigDecimal getEndTimasCurrency(Map<String, Object> map);

    /**
     * 查询增加金额
     *
     * @param map
     * @return
     */
    BigDecimal getAddCurrencyNumber(Map<String, Object> map);

    /**
     * 查询增加金额
     *
     * @param map
     * @return
     */
    BigDecimal getRedCurrencyNumber(Map<String, Object> map);

    //统计数量
    int countForCurrency(Map<String, Object> map);

    //查询详情
    List<CustomerCurrencyDTO> getDetail(Map<String, Object> map);

    //查询用户积分详情
    List<CustomerCurrencyLogDTO> getCurrencyLogByCustomerId(Map<String, Object> map);

    /**
     * 统计同一个customerId下积分log数量
     *
     * @param map
     * @return
     */
    int countForCurrencyLog(Map<String, Object> map);

    /**
     * 统计所选月份积分统计
     */
    List<Map<String, Object>> getMouthCurrency(Map<String, String> map);

    /**
     * 手机号查询ushop
     */
    CustomerUshopDO getUshopByMobile(String phone);


    List<CustomerUshopDO> getUshopByMobiles(String mobile);
}
